﻿using System;
using System.Collections.Generic;
using System.Text;
using Csla;
using Microsoft.Practices.EnterpriseLibrary.Data;
using System.Data.Common;
using Csla.Data;

namespace buildingLib.fee
{
    public class FeeNotifyList : BusinessListBase<FeeNotifyList, FeeNotify>
    {
        #region Factory Method
        private FeeNotifyList() { }

        static public FeeNotifyList GetFeeNotifyList(string where)
        {
            FeeNotifyList list = new FeeNotifyList();
            list.Fetch(where);
            return list;
        }
        #endregion

        #region DataMethod
        public void Fetch(string where)
        {
            this.Clear();
            string sql = "Select id from FeeNotify where ";
            sql += where;
            Database db = SQLDatabase.GetDatabase();
            DbCommand cmd = db.GetSqlStringCommand(sql);
            using (SafeDataReader dr = new SafeDataReader(db.ExecuteReader(cmd)))
            {
                while (dr.Read())
                {
                    this.Add(FeeNotify.GetNewNotify(dr.GetGuid("id")));
                }
            }
        }
        #endregion
    }
}
